

local ningjie = fk.CreateSkill{
  name = "wk_heg__ningjie",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["wk_heg__ningjie"] = "佞解",
  [":wk_heg__ningjie"] = "锁定技，当你于回合外成为伤害类锦囊牌的目标后，你令此牌对所有目标角色的效果改为【过河拆桥】且没有手牌的目标角色将手牌摸至体力上限。",
  ["#wk_heg__ningjie_effect"] = "佞解",
  ["wk_heg__ningjie_card_skill"] = "佞解",

  ["$wk_heg__ningjie1"] = "良谋失利，罪在先锋！",
  ["$wk_heg__ningjie2"] = "计略周详，怎奈指挥不当。",
}

ningjie:addEffect(fk.TargetConfirmed, {
  anim_type = "special",
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(ningjie.name) and player.room.current ~= player and data.card:isCommonTrick() and data.card.is_damage_card
  end,
  on_cost = Util.TrueFunc,
  on_use = function (self, event, target, player, data)
    data.extra_data = data.extra_data or {}
    data.extra_data.wk_heg__ningjie = true
  end
})

ningjie:addEffect(fk.PreCardEffect, {
  is_delay_effect = true,
  mute = true,
  can_trigger = function(self, event, target, player, data)
    return player == target and data.tos and data.extra_data and data.extra_data.wk_heg__ningjie
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local card = data.card:clone()
    local c = table.simpleClone(data.card)
    for k, v in pairs(c) do
      card[k] = v
    end
    card.skill = Fk.skills["wk_heg__ningjie_card_skill"] ---@type Skill
    data.card = card
  end,
})

return ningjie